home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / PictUtils.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  11KB  |  282 lines

  1. /*
  2.      File:        PictUtils.h
  3.  
  4.      Contains:    Picture Utilities Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __PICTUTILS__
  19. #define __PICTUTILS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __WINDOWS__
  25. #include <Windows.h>
  26. #endif
  27. #ifndef __PALETTES__
  28. #include <Palettes.h>
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT_SUPPORTED
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=mac68k
  41. #endif
  42.  
  43. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  44. /* verbs for the GetPictInfo, GetPixMapInfo, and NewPictInfo calls */
  45.  
  46. enum {
  47.     returnColorTable            = 0x0001,
  48.     returnPalette                = 0x0002,
  49.     recordComments                = 0x0004,
  50.     recordFontInfo                = 0x0008,
  51.     suppressBlackAndWhite        = 0x0010
  52. };
  53.  
  54.  
  55. enum {
  56.                                                                 /* color pick methods */
  57.     systemMethod                = 0,                            /* system color pick method */
  58.     popularMethod                = 1,                            /* method that chooses the most popular set of colors */
  59.     medianMethod                = 2,                            /* method that chooses a good average mix of colors */
  60.                                                                 /* color bank types */
  61.     ColorBankIsCustom            = -1,
  62.     ColorBankIsExactAnd555        = 0,
  63.     ColorBankIs555                = 1
  64. };
  65.  
  66. typedef long PictInfoID;
  67. struct CommentSpec {
  68.     short                             count;                        /* number of occurrances of this comment ID */
  69.     short                             ID;                            /* ID for the comment in the picture */
  70. };
  71. typedef struct CommentSpec CommentSpec;
  72.  
  73. typedef CommentSpec *CommentSpecPtr;
  74. typedef CommentSpecPtr *CommentSpecHandle;
  75. struct FontSpec {
  76.     short                             pictFontID;                    /* ID of the font in the picture */
  77.     short                             sysFontID;                    /* ID of the same font in the current system file */
  78.     long                             size[4];                    /* bit array of all the sizes found (1..127) (bit 0 means > 127) */
  79.     short                             style;                        /* combined style of all occurrances of the font */
  80.     long                             nameOffset;                    /* offset into the fontNamesHdl handle for the font's name */
  81. };
  82. typedef struct FontSpec FontSpec;
  83.  
  84. typedef FontSpec *FontSpecPtr;
  85. typedef FontSpecPtr *FontSpecHandle;
  86. struct PictInfo {
  87.     short                             version;                    /* this is always zero, for now */
  88.     long                             uniqueColors;                /* the number of actual colors in the picture(s)/pixmap(s) */
  89.     PaletteHandle                     thePalette;                    /* handle to the palette information */
  90.     CTabHandle                         theColorTable;                /* handle to the color table */
  91.     Fixed                             hRes;                        /* maximum horizontal resolution for all the pixmaps */
  92.     Fixed                             vRes;                        /* maximum vertical resolution for all the pixmaps */
  93.     short                             depth;                        /* maximum depth for all the pixmaps (in the picture) */
  94.     Rect                             sourceRect;                    /* the picture frame rectangle (this contains the entire picture) */
  95.     long                             textCount;                    /* total number of text strings in the picture */
  96.     long                             lineCount;                    /* total number of lines in the picture */
  97.     long                             rectCount;                    /* total number of rectangles in the picture */
  98.     long                             rRectCount;                    /* total number of round rectangles in the picture */
  99.     long                             ovalCount;                    /* total number of ovals in the picture */
  100.     long                             arcCount;                    /* total number of arcs in the picture */
  101.     long                             polyCount;                    /* total number of polygons in the picture */
  102.     long                             regionCount;                /* total number of regions in the picture */
  103.     long                             bitMapCount;                /* total number of bitmaps in the picture */
  104.     long                             pixMapCount;                /* total number of pixmaps in the picture */
  105.     long                             commentCount;                /* total number of comments in the picture */
  106.     long                             uniqueComments;                /* the number of unique comments in the picture */
  107.     CommentSpecHandle                 commentHandle;                /* handle to all the comment information */
  108.     long                             uniqueFonts;                /* the number of unique fonts in the picture */
  109.     FontSpecHandle                     fontHandle;                    /* handle to the FontSpec information */
  110.     Handle                             fontNamesHandle;            /* handle to the font names */
  111.     long                             reserved1;
  112.     long                             reserved2;
  113. };
  114. typedef struct PictInfo PictInfo;
  115.  
  116. typedef PictInfo *PictInfoPtr;
  117. typedef PictInfoPtr *PictInfoHandle;
  118. typedef pascal OSErr (*InitPickMethodProcPtr)(SInt16 colorsRequested, UInt32 *dataRef, SInt16 *colorBankType);
  119.  
  120. #if GENERATINGCFM
  121. typedef UniversalProcPtr InitPickMethodUPP;
  122. #else
  123. typedef InitPickMethodProcPtr InitPickMethodUPP;
  124. #endif
  125.  
  126. enum {
  127.     uppInitPickMethodProcInfo = kPascalStackBased
  128.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  129.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SInt16)))
  130.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(UInt32 *)))
  131.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(SInt16 *)))
  132. };
  133.  
  134. #if GENERATINGCFM
  135. #define NewInitPickMethodProc(userRoutine)        \
  136.         (InitPickMethodUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppInitPickMethodProcInfo, GetCurrentArchitecture())
  137. #else
  138. #define NewInitPickMethodProc(userRoutine)        \
  139.         ((InitPickMethodUPP) (userRoutine))
  140. #endif
  141.  
  142. #if GENERATINGCFM
  143. #define CallInitPickMethodProc(userRoutine, colorsRequested, dataRef, colorBankType)        \
  144.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppInitPickMethodProcInfo, (colorsRequested), (dataRef), (colorBankType))
  145. #else
  146. #define CallInitPickMethodProc(userRoutine, colorsRequested, dataRef, colorBankType)        \
  147.         (*(userRoutine))((colorsRequested), (dataRef), (colorBankType))
  148. #endif
  149. typedef pascal OSErr (*RecordColorsProcPtr)(UInt32 dataRef, RGBColor *colorsArray, SInt32 colorCount, SInt32 *uniqueColors);
  150.  
  151. #if GENERATINGCFM
  152. typedef UniversalProcPtr RecordColorsUPP;
  153. #else
  154. typedef RecordColorsProcPtr RecordColorsUPP;
  155. #endif
  156.  
  157. enum {
  158.     uppRecordColorsProcInfo = kPascalStackBased
  159.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  160.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32)))
  161.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(RGBColor *)))
  162.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(SInt32)))
  163.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(SInt32 *)))
  164. };
  165.  
  166. #if GENERATINGCFM
  167. #define NewRecordColorsProc(userRoutine)        \
  168.         (RecordColorsUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppRecordColorsProcInfo, GetCurrentArchitecture())
  169. #else
  170. #define NewRecordColorsProc(userRoutine)        \
  171.         ((RecordColorsUPP) (userRoutine))
  172. #endif
  173.  
  174. #if GENERATINGCFM
  175. #define CallRecordColorsProc(userRoutine, dataRef, colorsArray, colorCount, uniqueColors)        \
  176.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppRecordColorsProcInfo, (dataRef), (colorsArray), (colorCount), (uniqueColors))
  177. #else
  178. #define CallRecordColorsProc(userRoutine, dataRef, colorsArray, colorCount, uniqueColors)        \
  179.         (*(userRoutine))((dataRef), (colorsArray), (colorCount), (uniqueColors))
  180. #endif
  181. typedef pascal OSErr (*CalcColorTableProcPtr)(UInt32 dataRef, SInt16 colorsRequested, void *colorBankPtr, CSpecArray resultPtr);
  182.  
  183. #if GENERATINGCFM
  184. typedef UniversalProcPtr CalcColorTableUPP;
  185. #else
  186. typedef CalcColorTableProcPtr CalcColorTableUPP;
  187. #endif
  188.  
  189. enum {
  190.     uppCalcColorTableProcInfo = kPascalStackBased
  191.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  192.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32)))
  193.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(SInt16)))
  194.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
  195.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(CSpecArray*)))
  196. };
  197.  
  198. #if GENERATINGCFM
  199. #define NewCalcColorTableProc(userRoutine)        \
  200.         (CalcColorTableUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalcColorTableProcInfo, GetCurrentArchitecture())
  201. #else
  202. #define NewCalcColorTableProc(userRoutine)        \
  203.         ((CalcColorTableUPP) (userRoutine))
  204. #endif
  205.  
  206. #if GENERATINGCFM
  207. #define CallCalcColorTableProc(userRoutine, dataRef, colorsRequested, colorBankPtr, resultPtr)        \
  208.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCalcColorTableProcInfo, (dataRef), (colorsRequested), (colorBankPtr), (resultPtr))
  209. #else
  210. #define CallCalcColorTableProc(userRoutine, dataRef, colorsRequested, colorBankPtr, resultPtr)        \
  211.         (*(userRoutine))((dataRef), (colorsRequested), (colorBankPtr), (resultPtr))
  212. #endif
  213. typedef pascal OSErr (*DisposeColorPickMethodProcPtr)(UInt32 dataRef);
  214.  
  215. #if GENERATINGCFM
  216. typedef UniversalProcPtr DisposeColorPickMethodUPP;
  217. #else
  218. typedef DisposeColorPickMethodProcPtr DisposeColorPickMethodUPP;
  219. #endif
  220.  
  221. enum {
  222.     uppDisposeColorPickMethodProcInfo = kPascalStackBased
  223.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  224.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32)))
  225. };
  226.  
  227. #if GENERATINGCFM
  228. #define NewDisposeColorPickMethodProc(userRoutine)        \
  229.         (DisposeColorPickMethodUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDisposeColorPickMethodProcInfo, GetCurrentArchitecture())
  230. #else
  231. #define NewDisposeColorPickMethodProc(userRoutine)        \
  232.         ((DisposeColorPickMethodUPP) (userRoutine))
  233. #endif
  234.  
  235. #if GENERATINGCFM
  236. #define CallDisposeColorPickMethodProc(userRoutine, dataRef)        \
  237.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppDisposeColorPickMethodProcInfo, (dataRef))
  238. #else
  239. #define CallDisposeColorPickMethodProc(userRoutine, dataRef)        \
  240.         (*(userRoutine))((dataRef))
  241. #endif
  242. extern pascal OSErr GetPictInfo(PicHandle thePictHandle, PictInfo *thePictInfo, short verb, short colorsRequested, short colorPickMethod, short version)
  243.  THREEWORDINLINE(0x303C, 0x0800, 0xA831);
  244.  
  245. extern pascal OSErr GetPixMapInfo(PixMapHandle thePixMapHandle, PictInfo *thePictInfo, short verb, short colorsRequested, short colorPickMethod, short version)
  246.  THREEWORDINLINE(0x303C, 0x0801, 0xA831);
  247.  
  248. extern pascal OSErr NewPictInfo(PictInfoID *thePictInfoID, short verb, short colorsRequested, short colorPickMethod, short version)
  249.  THREEWORDINLINE(0x303C, 0x0602, 0xA831);
  250.  
  251. extern pascal OSErr RecordPictInfo(PictInfoID thePictInfoID, PicHandle thePictHandle)
  252.  THREEWORDINLINE(0x303C, 0x0403, 0xA831);
  253.  
  254. extern pascal OSErr RecordPixMapInfo(PictInfoID thePictInfoID, PixMapHandle thePixMapHandle)
  255.  THREEWORDINLINE(0x303C, 0x0404, 0xA831);
  256.  
  257. extern pascal OSErr RetrievePictInfo(PictInfoID thePictInfoID, PictInfo *thePictInfo, short colorsRequested)
  258.  THREEWORDINLINE(0x303C, 0x0505, 0xA831);
  259.  
  260. extern pascal OSErr DisposePictInfo(PictInfoID thePictInfoID)
  261.  THREEWORDINLINE(0x303C, 0x0206, 0xA831);
  262.  
  263. #if OLDROUTINENAMES
  264. #define DisposPictInfo(thePictInfoID) DisposePictInfo(thePictInfoID)
  265. #endif
  266. #endif
  267.  
  268. #if PRAGMA_ALIGN_SUPPORTED
  269. #pragma options align=reset
  270. #endif
  271.  
  272. #if PRAGMA_IMPORT_SUPPORTED
  273. #pragma import off
  274. #endif
  275.  
  276. #ifdef __cplusplus
  277. }
  278. #endif
  279.  
  280. #endif /* __PICTUTILS__ */
  281.  
  282.